//
//  WCCareNurseCell.m
//  WC
//
//  Created by wsj2015 on 15/9/11.
//  Copyright (c) 2015年 ShanghaiCize Trade And Business Co., Ltd. All rights reserved.
//

#import "WCCareNurseCell.h"
#import "WCImageView +setImage.h"
@implementation WCCareNurseCell
{
    BOOL _isUnable;
}

- (void)setNurse:(WCNNurseModel *)nurse{
    _nurse = nurse;
    self.nureNameLabel.text =nurse.name;
    self.hosipitalLabel.text =nurse.hospitalName;
    //    if (nurse.categoryNameArrStr) {
    //        self.categryLabel.text =[NSString stringWithFormat:@"擅长科室:%@",nurse.categoryNameArrStr];
    //    }else{
    //        self.categryLabel.text =[NSString stringWithFormat:@"擅长科室:暂无"];
    //    }
    if (nurse.jobTitle) {
        self.jobTitleLabel.text =nurse.jobTitle;
    }else{
        self.jobTitleLabel.text =@"";
    }
    if (nurse.workAge) {
        self.workAgeLabel.text =[NSString stringWithFormat:@"%@年",nurse.workAge];
    }else{
        self.workAgeLabel.text =@"";
        
    }
    if (nurse.goodSkill) {
        self.categryLabel.text =[NSString stringWithFormat:@"擅长:%@",nurse.goodSkill];
    }else{
        self.categryLabel.text =@"擅长:";
        
    }
    //    if (nurse.latestAppointmentTime) {
    //        self.lastAppTimeLabel.text =[NSString stringWithFormat:@"最近一次可预约的时间:%@%@",nurse.latestAppointmentTime.workDate,nurse.latestAppointmentTime.timePeriod];
    //    }else{
    //         self.lastAppTimeLabel.text =[NSString stringWithFormat:@"最近一次可预约的时间:无"];
    //
    //    }
    
    
    
    [self.nurseIcon setImageWithUrl:nurse.avatarFileId];
   

}


+ (WCCareNurseCell *)cellWithTableView:(UITableView *)tableView
{
    static NSString *cellId =@"nuresCellId";
    WCCareNurseCell *cell =[tableView dequeueReusableCellWithIdentifier:cellId];
    if (cell == nil) {
        cell =[[[NSBundle  mainBundle]loadNibNamed:@"WCCareNurseCell" owner:nil options:nil]lastObject];
    }
    cell.selectionStyle =UITableViewCellSelectionStyleNone;
    return cell;
    
}
- (void)awakeFromNib {
    // Initialization code
    self.nurseIcon.layer.cornerRadius =35;
    self.nurseIcon.layer.masksToBounds = YES;
    _isUnable = NO;
}

- (void)setUnableArray:(NSArray *)unableArray{
    _unableArray = unableArray;
    self.backgroundColor = [UIColor whiteColor];
    _isUnable = NO;
    self.userInteractionEnabled = YES;
    self.indecatorView.image =[UIImage imageNamed:@"Selected_no"];
    for (id model in unableArray) {
        if ([[model valueForKey:@"stringId"] isEqualToString:_nurse.stringId] ) {
            self.indecatorView.image = [UIImage imageNamed:@"不可选"];
            
            _isUnable = YES;
            self.userInteractionEnabled = NO;
            return;
        }
    }
    

}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    if (_isUnable ==YES) {
        return;
    }
    self.indecatorView.image =selected?[UIImage imageNamed:@"Mult_Select"]:[UIImage imageNamed:@"Selected_no"];
//    self.selectTag.image = [UIImage imageNamed:@"Mult_Select"];
//}else{
//    self.selectTag.image = [UIImage imageNamed:@"Selected_no"];
    // Configure the view for the selected state
}

@end
